﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace KvoMvc.ServiceProxy
{
    public class ProxyHelper
    {
        /// <summary>
        /// Create a remote object based on an endpoint configuration.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="endpointConfigurationName"></param>
        /// <returns></returns>
        public static T CreateRemoteObject<T>(string endpointConfigurationName)
        {
            ChannelFactory<T> factory = new ChannelFactory<T>(endpointConfigurationName);
            T result = factory.CreateChannel();

            return result;
        }
    }
}
